With JSP 2.1 pattern like ${} and #{} are valid expression (immediate and deferred expression respectively). From JSP 2.1 specification the following is how a container should treat page level expression in a JSP page.
The following is how container should treat tag directive should evalute expression or not.
Both tables above are found in JSP 2.1 specification at page 80. The JSP 2.1 expression like #{} has different meaning in OGNL expression, in the later it means create a Map. However, using WebWork tags like <ww:set name="myMap" value="%{#{'one':'ONE','two':'TWO','three':'THREE'}}" /> would still continue to work, if it doesn't for some reason, another alternative would be to replace it with <ww:set name="myMap" value="%{#@java.util.HashMap@{'one':'ONE','two':'TWO','three':'THREE'}}" if order is important, we could use <ww:set name="myMap" value="%{#@java.util.LinkedHashMap@{'one':'ONE','two':'TWO','three':'THREE'}}" /> The first version should continue to work because WebWork tags are defined using tld <taglib> ... <jsp-version>1.2</jsp-version> ... </taglib> as oppose to <taglib> ... <jsp-version>2.1</jsp-version> ... </taglib> where JSP 2.1 diferred expression ( #{} ) will be parsed. Using WebWork tags like <ww:url id="url" action="myAction" namespace="/namespace" /> <ww:a href="%{#url}">Click on ME !</ww:a> should contine to work regardless of whether its in a JSP 2.1 container or not, as the syntax recongnized by JSP 2.1 containers are ${} and #{} With JSP 2.1 containers we could do <ww:url id="url" action="myAction" namespace="/namespace" /> <ww:set name="myUrl" value="%{#url}" scope="request" /> The url is (using JSP 2.1 EL) ${requestScope.myUrl} The url is (using WebWork's property tag) <ww:property value="%{#request.myUrl}" /> such that WebWork's tag could live side by side with JSP 2.1 EL As far as WebWork's tag is concerned, it doesn't have tag directive isELIgnored specified, which means that it will evalute JSP 2.1 EL as indicated in the table above. In fact we could do stuff like <ww:set name="varOne" value="%{'apple'}" /> <ww:set name="varTwo" value="%{'orange'}" scope="request" /> <ww:property value="%{#varOne+' and ${requestScope.varTwo}'}" /> which will print out apple and orange The explanation being, JSP 2.1 EL will be parsed by the container, such that the WebWork property tag OGNL value expression %{#varOne+' and ${requestScope.varTwo}'} will now be %{#varOne+ ' and orange'} before it is passed to WebWork's property tag, which upon evaluation will become apple and orange Some other information (web.xml) that might be usefull :- <jsp-property-group> <url-pattern>*.jsp</url-pattern> <!-- ignore JSP 2.1 expression language --> <el-ignored>true</el-ignored> <!-- don't allow scriptlets --> <scripting-invalid>true</scripting-invalid> <!-- allow differed syntax as literal --> <deferred-syntax-allowed-as-literal>true</deferred-syntax-allowed-as-literal> </jsp-property-group> or at page level <%@page isELIgnored="true" scriptingInvalid="true" deferredSyntaxAllowedAsLiteral="true" > References[1] - http://today.java.net/pub/a/today/2006/03/07/unified-jsp-jsf-expression-language.html |